<script>
    $("#formDoSubmitDialogMy").validator({
        submit: function() {
            if(this.isFormValid()) {
                var that = $("#formDoSubmitDialogMy")
                var submitBtn = that.find('button[type="submit"]')
                if(submitBtn.hasClass('am-disabled')){
                    return false;
                }
                submitBtn.addClass('am-disabled');
                $.ajax({
                    url: that.attr("action")
                    , type: 'post'
                    , data: that.serialize()
                    , dataType: 'json'
                    , success: function (response) {
                        if (response.code === 0) {
                            parent.dialogReback(response.data);
                        }else {
                            layer.msg(response.msg);
                            submitBtn.removeClass('am-disabled');
                        }
                    }
                    , error: function (error) {
                        submitBtn.removeClass('am-disabled');
                        layer.alert('数据提交失败！');
                    }
                });
            }
            return false;
        }
    });
    $('#bId').change(function () {
        $('#brand_name').val($(this).find(":selected").text());
    });
</script>